
if exists (select 1 from sysobjects where name = 'get_shemas' and type = 'P')
begin
   drop procedure get_shemas
   print 'Procedure: get_shemas deleted ...'
end
go
create procedure get_shemas(
  @mandid             char(2)           = 'li',
  @status             int               = 1 --1:Active   0:All
)
as
begin
  set nocount on

  select schemaid = SchemaID,
         name = Name,
         status = Status
    from Schemas
   where (Status = @status or @status = 0)

end
go
print 'Procedure: get_shemas done ...'
go
grant exec on get_shemas to prsadmins with grant option
go
grant exec on get_shemas to prsusers
go

